gesture: Protect against odd window hierarchies
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 28 Apr 2014 10:53:36 +0000 (12:53 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Fri, 23 May 2014 17:54:29 +0000 (19:54 +0200)
If no match is found with the gesture widget when poking the event
window parents, bail out safely instead of falling in an infinite
loop. This was seen on Mutter.

gtk/gtkgesture.c

index e1f03d8dd92f5605df267b0ff654698ac5aec89f..30d944a76ce64533e379fe682446a0aea674c258 100644 (file)
@@ -318,7 +318,7 @@ _update_widget_coordinates (GtkGesture *gesture,
   gdk_event_get_coords (data->event, &event_x, &event_y);
   window = data->event->any.window;
 
-  while (window != event_widget_window)
+  while (window && window != event_widget_window)
     {
       gdk_window_get_position (window, &wx, &wy);
       event_x += wx;
@@ -326,6 +326,9 @@ _update_widget_coordinates (GtkGesture *gesture,
       window = gdk_window_get_effective_parent (window);
     }
 
+  if (!window)
+    return;
+
   if (!gtk_widget_get_has_window (event_widget))
     {
       gtk_widget_get_allocation (event_widget, &allocation);